<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2017/8/23
 * Time: 14:22
 */
//error_reporting(0);
include_once '../lib/aliyun-php-sdk-core/Config.php';
//use \Iot\Request\v20170420 as Iot;
use \Iot\Request\V20170420\RegistDeviceRequest;

//设置你的AccessKeyId/AccessSecret/ProductKey
$accessKeyId = "LTAIy8dX7j1omWO1";
$accessSecret = "E5LyOmoFLI9iTv6t3KwJgFDQyrlxAQ";
$iClientProfile = DefaultProfile::getProfile("cn-shanghai", $accessKeyId, $accessSecret);
$client = new DefaultAcsClient($iClientProfile);
$request = new RegistDeviceRequest();
$request->setProductKey("jmibOFirUOO");
$request->setDeviceName("leotest3331111");//可以设空，如果名称为空则由阿里云生成设备名称默认与设备id一致。设备名称在产品内唯一，如果已存在则返回已有设备
$resp = $client->getAcsResponse($request);
header('Content-Type: application/json');
header('Content-Type: text/html;charset=utf-8');
echo   json_encode($resp);

?>